package com.mtzqc.common.manager

import androidx.annotation.StringRes
import com.mtzqc.common.app.App
import com.mtzqc.common.kt.loadService
import com.mtzqc.common.service.ToastService

object ToastManager {
    val service: ToastService by lazy {
        loadService()
    }

    fun toast(@StringRes resId: Int) {
        service.toast(resId)
    }

    fun toast(sequence: CharSequence?) {
        if (!sequence.isNullOrBlank()) {
            service.toast(sequence)
        }
    }

    fun toastLong(@StringRes resId: Int) {
        service.toastLong(resId)
    }

    fun toastLong(sequence: CharSequence?) {
        if (!sequence.isNullOrBlank()) {
            service.toastLong(sequence)
        }
    }

    fun dToast(sequence: CharSequence?) {
        if (App.isDebug()) {
            toast(sequence)
        }
    }

}